package com.yidiandao.business.ui.main.shoppingcart.choosegift;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.utils.ActivityUtils;

/** 换购商品-Activity. */
public class ChooseGiftActivity extends BaseActivity {

    private ChooseGiftFragment mChooseGiftFragment;

    public static void actionStart(Activity activity, String actId) {
        Intent intent = new Intent(activity, ChooseGiftActivity.class);
        intent.putExtra(Intents.EXTRA_ACT_ID, actId);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mChooseGiftFragment =
                (ChooseGiftFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_choose_gift);

        if (mChooseGiftFragment == null) {
            mChooseGiftFragment = ChooseGiftFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), mChooseGiftFragment, R.id.container_choose_gift);
        }
    }

    @Override
    protected void initPresenter() {
        new ChooseGiftPresenter(mChooseGiftFragment);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_choose_gift;
    }
}
